package routers

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"news-hub/handlers"
)

func Init() *gin.Engine {

	r := gin.Default()
	r.Use(cors.Default())          //跨域
	r.Static("static", "./static") //静态文件

	r.GET("/test", handlers.Test)

	r.POST("/news/add", handlers.Add)  //添加
	r.GET("/news/list", handlers.List) //列表
	return r
}
